/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package testes;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.jxta.endpoint.StringMessageElement;

/**
 *
 * @author root
 */
public class ByteArrayTeste {

    public static void main(String[] args) {
        try {
            String s = "Leo";
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            ObjectOutputStream os = new ObjectOutputStream(out);
            os.writeObject(s);
            System.out.println(out.toByteArray());

        } catch (IOException ex) {
            Logger.getLogger(ByteArrayTeste.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
